package com.shycloud.mido.member.api.feign;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.common.core.constant.SecurityConstants;
import com.shycloud.mido.common.core.constant.ServiceNameConstants;
import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.member.api.dto.FavoriteTeacherDTO;
import com.shycloud.mido.member.api.dto.MemberLoginInfo;
import com.shycloud.mido.member.api.dto.MemberRoleDTO;
import com.shycloud.mido.member.api.entity.*;
import com.shycloud.mido.member.api.vo.MemberDetailVO;
import com.shycloud.mido.member.api.vo.MyTeacherVO;
import com.shycloud.mido.member.api.vo.StudentVO;
import com.shycloud.mido.member.api.vo.TeacherVO;
import com.shycloud.mido.member.api.vo.WeekDataMemberVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author npc
 * @date 2018/6/22
 */
@FeignClient(value = ServiceNameConstants.MEMBER_SERVICE)
public interface RemoteMemberService {

	/**
	 * 通过用户名查询用户、角色信息
	 *
	 * @param username username
	 * @param from     调用标志
	 * @return R
	 */
	@GetMapping("/v1/mobile/info/{username}")
	R<MemberLoginInfo> info(@PathVariable("username") String username
			, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 根据type@code查询用户
	 *
	 * @param inStr appid@code
	 * @param from  调用标志
	 * @return R
	 */
	@GetMapping("/v1/mobile/load/{inStr}")
	R<MemberLoginInfo> load(@PathVariable("inStr") String inStr
			, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 获取用户信息
	 *
	 * @param userid 会员id
	 * @return R
	 */
	@PostMapping("/member/old/memberInfo/{userid}")
	Member memberInfo(@PathVariable("userid") String userid);

	/**
	 * 通过手机号获取用户信息
	 *
	 * @param phone 会员手机号
	 * @return R
	 */
	@PostMapping("/member/memberInfoByPhone/{phone}")
	Member memberInfoByPhone(@PathVariable("phone") String phone);

	/**
	 * 学生收藏教师详情
	 *
	 * @param memberId 教师ID
	 * @return
	 */
	@PostMapping("/teacher/favoriteTeacher")
	FavoriteTeacherDTO favoriteTeacher(@RequestParam("memberId") String memberId);

	/**
	 * 获取教师信息
	 *
	 * @param memberId 会员id
	 * @return R
	 */
	@PostMapping("/teacher/teacherInfo/{memberId}")
	Teacher teacherInfo(@PathVariable("memberId") String memberId);

	/**
	 * 注册会员
	 *
	 * @param member 会员信息
	 * @return R
	 */
	@PostMapping(value = "/member/saveMember", consumes = "application/json")
	R saveMember(@RequestBody Member member);

	/**
	 * 获取指定身份的会员ID
	 *
	 * @param type 身份标示
	 * @return List<String>
	 */
	@GetMapping("/member/memberList/{type}")
	List<String> memberIdList(@PathVariable("type") String type,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 管理平台注册会员
	 *
	 * @param memberDetailVO 会员信息
	 * @return R
	 */
	@PostMapping("/member/adminSaveMember")
	String adminSaveMember(@RequestBody MemberDetailVO memberDetailVO);

	/**
	 * 管理平台更新会员密码
	 *
	 * @param memberId 会员ID
	 * @param pwd      密码
	 * @return
	 */
	@PostMapping("/member/updPwd")
	Boolean updPwd(@RequestParam("memberId") String memberId, @RequestParam("pwd") String pwd);

	/**
	 * 会员活跃积分操作
	 *
	 * @param code     策略code
	 * @param memberId 会员id
	 * @return
	 */
	@PostMapping("/activePoints")
	void activePoints(@RequestParam("code") String code, @RequestParam("memberId") String memberId);

	/**
	 * 更新会员个推会员标识
	 *
	 * @param memberId 会员ID
	 * @param clientId 个推会员标识
	 */
	@PostMapping("/member/updClientId")
	void updClientId(@RequestParam("memberId") String memberId,
			@RequestParam("clientId") String clientId);

	/**
	 * 通过id查询关联家长信息
	 *
	 * @param id id
	 * @return R
	 */
	@PostMapping("/v1/mobile/getParent/{id}")
	List<Member> getParent(@PathVariable("id") String id);

	/**
	 * 离会员到期1个月 离会员到期7天 离会员到期3天 de 所有会员
	 *
	 * @return
	 */
	@PostMapping("/v1/mobile/roleExpire")
	List<MemberRoleDTO> roleExpire();

	/**
	 * 获取用户信息
	 *
	 * @param userid 会员id
	 * @return R
	 */
	@PostMapping("/member/memberInfo/{userid}")
	Member memberInfo(@PathVariable("userid") String userid,
			@RequestHeader(SecurityConstants.FROM) String from);

	@GetMapping("/hardwareSale/checkCombGoods")
	Integer checkCombGoods(@RequestParam("goodsId") Integer goodsId,
			@RequestParam("quantity") Integer quantity);

	@PostMapping("/hardwareSale/addComboMini")
	R addComboMini(@RequestBody BasicComboInfo basicComboInfo);

	@GetMapping("/opt/device/existBusiType3ByMemberId")
	Boolean existBusiType3ByMemberId(@RequestParam("memberId") String memberId);

	@PostMapping("/hardwareSale/updStockDeviceInfo")
	R updStockDeviceInfo(@RequestBody StockDeviceInfo stockDeviceInfo);

	@GetMapping("/member/getTotalTimeRank")
	Integer getTotalTimeRank(@RequestParam("weekId") String weekId,
			@RequestParam("memberId") String memberId);

	@GetMapping("/webapi/delCloudResourse")
	R delCloudResourse(@RequestParam("bucketName") String bucketName,
			@RequestParam("url") String url);

	@GetMapping("/webapi/getHomeworkDoneCountRank")
	Integer getHomeworkDoneCountRank(@RequestParam("weekId") String weekId,
			@RequestParam("memberId") String memberId);

	@GetMapping("/webapi/pageMemberListByWeekV3")
	List<WeekDataMemberVO> pageMemberListByWeekV3(@RequestParam("current") Integer current,
			@RequestParam("size") Integer size,
			@RequestHeader(SecurityConstants.FROM) String from);

	@GetMapping("/webapi/batchAddMemberMaster")
	R<Boolean> batchAddMemberMaster(@RequestHeader(SecurityConstants.FROM) String from);

	@GetMapping("/teacherStudent/getStudentInfoFeign")
	StudentVO getStudentInfoFeign(@RequestParam("studentId") String studentId);

	@GetMapping("/teacherStudent/getTeacherInfoFeign")
	TeacherVO getTeacherInfoFeign(@RequestParam("teacherId") String teacherId);

	@GetMapping("/v1/multi-teacher-classroom-link/getTeacherListByRoomIdFeign")
	List<MyTeacherVO> getTeacherListByRoomIdFeign(@RequestParam("classroomId") String classroomId);

	@GetMapping("/v1/multi-assist/queryFeign")
	MultiAssist getAssistCount(@RequestParam("subject") String subject, @RequestParam("memberId") String memberId);

	@GetMapping("/v1/multi-classroom/getClassroomId")
	String getClassroomId(@RequestParam("teacherId") String teacherId, @RequestParam("studentId") String studentId);

	@GetMapping("/member/batchSaveMemberGold")
	R batchSaveMemberGold(@RequestBody List<Member> members);

	@GetMapping("/pay/batchAliTradePay")
	R batchAliTradePay(@RequestHeader(SecurityConstants.FROM) String from);

}
